package com.letao.server.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ElasticSearch工具类
 */
@Configuration
public class RestElasticSearchClientConfig {

    private String url = "192.168.126.130";

    private Integer port = 9200;

    @Bean
    public RestHighLevelClient restHighLevelClient() {
        RestHighLevelClient restHighLevelClient = new RestHighLevelClient(RestClient.builder(
                new HttpHost(url, port, "http")));
        return restHighLevelClient;
    }
}
